package com.settlement.system.service.impl;

import com.settlement.system.mapper.BaseMapper;
import com.settlement.system.mapper.TblReceiveRefundSupplierMapper;
import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.TblReceiveRefundSupplier;
import com.settlement.system.service.ITblReceiveRefundSupplierService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * 收退款-供应商 服务实现类
 * @author Ximi
 * @since 2020-06-18
 */
@Slf4j
@Service
public class TblReceiveRefundSupplierServiceImpl extends BaseServiceImpl implements ITblReceiveRefundSupplierService {

    @Resource
    private TblReceiveRefundSupplierMapper tblReceiveRefundSupplierMapper;

    @Override
    public BaseMapper init() {
        return tblReceiveRefundSupplierMapper;
    }

    @Override
    public TblReceiveRefundSupplier getByAccountBookShortNameAndSupplierName(
            String accountBookShortName, String supplierName) throws ServiceException {
        try {
            return tblReceiveRefundSupplierMapper.
                    getByAccountBookShortNameAndSupplierName(accountBookShortName,supplierName);
        } catch (Exception ex){
            log.error("getByAccountBookShortNameAndSupplierName happen exception",ex);
            throw new ServiceException("getByAccountBookShortNameAndSupplierName happen exception",ex);
        }
    }

    /**
     * 根据NC供应商档案获取列表
     * @param ncSupplierRecord
     * @return
     */
    @Override
    public List<TblReceiveRefundSupplier> selectByNcSupplierRecord(String ncSupplierRecord){
        return tblReceiveRefundSupplierMapper.selectByNcSupplierRecord(ncSupplierRecord);
    }

}

